package ch.unisi.inf.java.project.riskbami.model;

import java.util.ArrayList;

/**
 * UseCardsCommand is an extension of GenericCommand.
 * Provide the implementation of a commands that is responsible to use
 * a set of cards owned by a player
 * 
 * @author minellir@lu.unisi.ch
 * @author babazadm@lu.unisi.ch
 */
public class UseCardsCommand extends GenericCommand
{
    private Player player;
    private ArrayList<Card> cards;
    
    /**
     * The constructor for the class UseCardsCommand
     * 
     * @param game The current game
     * @param cards The cards that the player want to exchange
     */
    public UseCardsCommand(Game game, ArrayList<Card> cards) {
        super(game);
        this.cards = cards;
        this.player = game.getCurrentPlayer();
    }

    /**
     * canExecute verify whether the ShowCardsCommand could be executed
     * 
     * @return boolean
     */
    public boolean canExecute() {
        if(game.getTurnPhase() == 1) {
            return true;
        }
        else return false;
    }
    
    /**
     * execute is responsible to execute the given ShowCardsCommand.
     */
    public void execute(){
        player.useCards(cards);
    }
    
}
